using System;
//using Microsoft.VisualBasic;
using System.Text;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SIS.BLL.Entities
{
    public class WebMessageBox
    {
        protected static Hashtable handlerPages = new Hashtable();
        static ScriptManager script1 = null;
        private WebMessageBox()
        {
        }
        public static Page currentPage = null;

        public static void Confirm(String message)
        {

            Page currentPage = (Page)HttpContext.Current.Handler;
            message = message.Trim().Replace("\r", "").Replace("\n", "").Replace("'", "\\'");


            System.Text.StringBuilder javaScript = new System.Text.StringBuilder();

            javaScript.Append("\n<script type='text/javascript'>\n");
            javaScript.Append("<!--\n");

            javaScript.Append("var userConfirmation = window.confirm('" + message + "');\n");
            // Un-comment to only PostBack if user answers OK...
            javaScript.Append("if ( userConfirmation == true )\n");
            javaScript.Append("__doPostBack('UserConfirmationPostBack', userConfirmation);\n");

            javaScript.Append("// -->\n");
            javaScript.Append("</script>\n");

            ScriptManager.RegisterStartupScript(currentPage, currentPage.GetType(), "ConfirmationScript", javaScript.ToString(), false);
        }


        public static void Show(string Message)
        {
            Page currentPage = (Page)HttpContext.Current.Handler;
            StringBuilder builder = new StringBuilder();
            Message = Message.Trim().Replace("\r", "").Replace("\n", "").Replace("'", "\\'");
            builder.Append("alert('" + Message + " ');");
            //currentPage.ClientScript.RegisterClientScriptBlock(currentPage.GetType(), "msgb", builder.ToString(), true);
            ScriptManager.RegisterStartupScript(currentPage, currentPage.GetType(), "msgb", builder.ToString(), true);

        }
        public static void Show_normal(string Message)
        {
            Page currentPage = (Page)HttpContext.Current.Handler;
            StringBuilder builder = new StringBuilder();
            Message = Message.Trim().Replace("\r", "").Replace("\n", "");
            builder.Append("alert('" + Message + " ')");
            currentPage.ClientScript.RegisterClientScriptBlock(currentPage.GetType(), "msgb", builder.ToString(), true);


        }
        
    }

}